////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Visual Treatment (Modular & Dynamic)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// =================================================================================================
// 🎛 UI PARAMETER
// =================================================================================================

// --- SYSTEM ---
float ui_PseudoHDR < string UIName = "Pseudo HDR Decode"; string UIGroup = "System"; string UIWidget = "Slider"; > = 1.0;

// --- PIPELINE ---
bool ui_UsePostEffects < string UIName = "Enable Post Effects"; string UIGroup = "Master Pipeline"; string UIWidget = "Checkbox"; int UIGroupOrder = 0; > = 1;
float ui_MotionBlurMask < string UIName = "Motion Blur Mask Scale"; string UIGroup = "Master Pipeline"; string UIWidget = "Slider"; float UIMin = 0.5; float UIMax = 2.0; > = 1.35;

// --- BASIC ---
float ui_Brightness < string UIName = "Global Brightness"; string UIGroup = "Basic Adjustments"; string UIWidget = "Slider"; float UIMin = 0.0; float UIMax = 3.0; int UIGroupOrder = 1; > = 1.00;
float ui_Contrast < string UIName = "Global Contrast"; string UIGroup = "Basic Adjustments"; string UIWidget = "Slider"; float UIMin = 0.0; float UIMax = 3.0; > = 1.05;

// --- TONEMAPPING ---
float ui_TonemapSelector < 
    string UIName = "Tonemap Operator"; 
    string UIGroup = "Tonemapping"; 
    string UIWidget = "Combo"; 
    string UIEnum = "Standard/None,Reinhard,ACES 2,ACES Legacy,Uncharted 2,Unreal Engine,Lottes,Gran Turismo,Narkowicz,AgX,Filmic ALU,NFS Heat Style,Reinhard 2,Uchimura";
    int UIGroupOrder = 2;
> = 2.0;

float ui_ExposureBias < string UIName = "Exposure Bias"; string UIGroup = "Tonemapping"; string UIWidget = "Slider"; float UIMin = 0.0; float UIMax = 5.0; > = 0.65;

// --- COLOR GRADING ---
float ui_PresetSelector < 
    string UIName = "Preset Selection"; 
    string UIGroup = "Color Grading"; 
    string UIWidget = "Combo"; 
    string UIEnum = "User Custom,Grid Autosport,Grid 2,NFS Shift 2,Forza Horizon,Forza Horizon 2,NFS Most Wanted 2012,NFS Carbon,Project CARS,Gran Turismo Sport,Gran Turismo 4,Gran Turismo 7,Assetto Corsa,Assetto Corsa Comp,The Crew,Dirt Rally 2.0,WRC Generations,Test Drive Unlimited,F1 23 Broadcast,Burnout Paradise";
    int UIGroupOrder = 3;
> = 0.0;

float ui_UseWhitebalance < string UIName = "Adaptive Whitebalance"; string UIGroup = "Color Grading"; string UIWidget = "Slider"; > = 1.0;
float ui_ColorTemp < string UIName = "Color Temperature"; string UIGroup = "Color Grading"; string UIWidget = "Slider"; float UIMin = -5.0; float UIMax = 5.0; > = 1.10;
float ui_UseLUT < string UIName = "Use LUT Texture"; string UIGroup = "Color Grading"; string UIWidget = "Slider"; > = 1.0;

// Custom Channels
float4 ui_RedChannel < string UIName = "Channel Mixer: Red"; string UIGroup = "Color Grading (User)"; string UIWidget = "Color"; int UIGroupOrder = 4; > = float4(1.0, 0.0, 0.0, 1.0);
float4 ui_GreenChannel < string UIName = "Channel Mixer: Green"; string UIGroup = "Color Grading (User)"; string UIWidget = "Color"; > = float4(0.0, 1.0, 0.0, 1.0);
float4 ui_BlueChannel < string UIName = "Channel Mixer: Blue"; string UIGroup = "Color Grading (User)"; string UIWidget = "Color"; > = float4(0.0, 0.0, 1.0, 1.0);
float ui_Luma < string UIName = "Luminance"; string UIGroup = "Color Grading (User)"; string UIWidget = "Slider"; float UIMin = 0.0; float UIMax = 2.0; > = 1.0;
float ui_Chroma < string UIName = "Saturation (Chroma)"; string UIGroup = "Color Grading (User)"; string UIWidget = "Slider"; float UIMin = 0.0; float UIMax = 3.0; > = 1.0;
float ui_SplitTone < string UIName = "Split Toning"; string UIGroup = "Color Grading (User)"; string UIWidget = "Slider"; > = 0.0;

// --- FX ---
float ui_BloomIntensity < string UIName = "Bloom Intensity (0 = OFF)"; string UIGroup = "Bloom & Glow"; string UIWidget = "Slider"; float UIMin = 0.0; float UIMax = 10.0; int UIGroupOrder = 5; > = 2.25;
float ui_BloomThreshold < string UIName = "Bloom Threshold"; string UIGroup = "Bloom & Glow"; string UIWidget = "Slider"; float UIMin = 0.0; float UIMax = 1.0; > = 0.70;
float ui_BloomSoftKnee < string UIName = "Bloom Soft Knee"; string UIGroup = "Bloom & Glow"; string UIWidget = "Slider"; float UIMin = 0.0; float UIMax = 1.0; > = 0.65;
float BLOOM_BLEND_MODE < string UIName = "Bloom Blend Mode (0=Screen, 1=Add)"; string UIGroup = "Bloom & Glow"; string UIWidget = "Slider"; float UIMin = 0.0; float UIMax = 1.0; > = 0.5;

float4 ui_HalationTint < string UIName = "Halation Tint"; string UIGroup = "Film Halation"; string UIWidget = "Color"; int UIGroupOrder = 6; > = float4(1.0, 0.35, 0.10, 1.0);
float ui_HalationStrength < string UIName = "Halation Strength (0 = OFF)"; string UIGroup = "Film Halation"; string UIWidget = "Slider"; float UIMin = 0.0; float UIMax = 10.0; > = 5.5;
float ui_HalationRadius < string UIName = "Halation Radius"; string UIGroup = "Film Halation"; string UIWidget = "Slider"; float UIMin = 0.0; float UIMax = 5.0; > = 1.5;
float ui_HalationThreshold < string UIName = "Halation Threshold"; string UIGroup = "Film Halation"; string UIWidget = "Slider"; float UIMin = 0.0; float UIMax = 1.0; > = 0.3;

float ui_LensDirtIntensity < string UIName = "Dirt Intensity (0 = OFF)"; string UIGroup = "Lens FX"; string UIWidget = "Slider"; float UIMin = 0.0; float UIMax = 5.0; int UIGroupOrder = 7; > = 1.0;
float ui_LensDirtThreshold < string UIName = "Dirt Threshold"; string UIGroup = "Lens FX"; string UIWidget = "Slider"; float UIMin = 0.0; float UIMax = 1.0; > = 0.15;
float ui_LensDirtBlendMode < string UIName = "Dirt Blend (0=Add, 1=Screen)"; string UIGroup = "Lens FX"; string UIWidget = "Slider"; float UIMin = 0.0; float UIMax = 1.0; > = 0.5;
float ui_LensDirtEdgePower < string UIName = "Dirt Edge Emphasis (Center Clear)"; string UIGroup = "Lens FX"; string UIWidget = "Slider"; float UIMin = 0.0; float UIMax = 10.0; > = 2.0;
float ui_LensDirtChroma < string UIName = "Dirt Chromatic Ab."; string UIGroup = "Lens FX"; string UIWidget = "Slider"; float UIMin = 0.0; float UIMax = 0.05; > = 0.005;

float ui_VignetteAmount < string UIName = "Vignette Amount (0 = OFF)"; string UIGroup = "Aesthetics"; string UIWidget = "Slider"; float UIMin = 0.0; float UIMax = 1.0; int UIGroupOrder = 8; > = 0.95;
float ui_VignetteRadius < string UIName = "Vignette Radius"; string UIGroup = "Aesthetics"; string UIWidget = "Slider"; float UIMin = 0.0; float UIMax = 2.0; > = 0.85;
float ui_VignetteCurve < string UIName = "Vignette Curve"; string UIGroup = "Aesthetics"; string UIWidget = "Slider"; float UIMin = 0.0; float UIMax = 3.0; > = 1.35;
float ui_FilmGrainStrength < string UIName = "Film Grain Strength (0 = OFF)"; string UIGroup = "Aesthetics"; string UIWidget = "Slider"; float UIMin = 0.0; float UIMax = 1.0; > = 0.065;

float ui_UseHDR < string UIName = "Enable FakeHDR"; string UIGroup = "Perception"; string UIWidget = "Slider"; int UIGroupOrder = 9; > = 1.0;
float ui_FakeHDRPower < string UIName = "FakeHDR Power"; string UIGroup = "Perception"; string UIWidget = "Slider"; float UIMin = 0.0; float UIMax = 2.0; > = 1.050;
float ui_SharpenAmount < string UIName = "Sharpen Amount (0 = OFF)"; string UIGroup = "Perception"; string UIWidget = "Slider"; float UIMin = 0.0; float UIMax = 2.0; > = 0.25;
float ui_DesaturationAmount < string UIName = "Desaturation Amount (0 = OFF)"; string UIGroup = "Perception"; string UIWidget = "Slider"; float UIMin = 0.0; float UIMax = 1.0; > = 0.00;
float ui_useLegacyCurve < string UIName = "Legacy Curves (0 = OFF)"; string UIGroup = "Perception"; string UIWidget = "Slider"; float UIMin = 0.0; float UIMax = 1.0; > = 0.00;

float ui_DepthOfField < string UIName = "Bokeh-DoF (0 = Off)"; string UIGroup = "Depth of Field"; string UIWidget = "Checkbox"; float UIMin = 0.0; float UIMax = 1.0; int UIGroupOrder = 10; > = 1.0;
float ui_DOFfocusDist < string UIName = "Focus Distance"; string UIGroup = "Depth of Field"; string UIWidget = "Slider"; float UIMin = 0.0; float UIMax = 500.0; > = 12.00;
float ui_DOFfocusRange < string UIName = "Range of Focus"; string UIGroup = "Depth of Field"; string UIWidget = "Slider"; float UIMin = 0.0; float UIMax = 500.0; > = 50.00;
float ui_DOFblurMax < string UIName = "Max Blur Opacity"; string UIGroup = "Depth of Field"; string UIWidget = "Slider"; float UIMin = 0.0; float UIMax = 1.0; > = 0.55;
float ui_DOFshapeInt < string UIName = "Bokeh Visibility"; string UIGroup = "Depth of Field"; string UIWidget = "Slider"; float UIMin = 0.0; float UIMax = 2.0; > = 1.25;

// =================================================================================================
// 🧱 INCLUDE
// =================================================================================================

#include "MODULES/global.h"
#include "MODULES/tonemap_variants.fx"
#include "MODULES/colorgrading_presets.fx"
#include "MODULES/visualtreatment.h"

#define DO_DOF(value)           value
#define DO_COLOUR_FADE(value)   value

// Techniques
technique visualtreatment
{
    pass p0
    {
        VertexShader = compile vs_3_0 vertex_shader_passthru();
        PixelShader = compile ps_3_0 PS_VisualTreatment(DO_DOF(false), DO_COLOUR_FADE(false));
    }
}

technique visualtreatment_enchanced
{
    pass p0
    {
        VertexShader = compile vs_3_0 vertex_shader_passthru();
        PixelShader = compile ps_3_0 PS_VisualTreatment(DO_DOF(true), DO_COLOUR_FADE(true));
    }
}

technique motionblur
{
    pass p0
    {
        VertexShader = compile vs_3_0 VS_MotionBlur();
        PixelShader = compile ps_3_0 PS_MotionBlur();
    }
}
technique composite_blur
{
    pass p0
    {
        VertexShader = compile vs_3_0 VS_CompositeBlur();
        PixelShader = compile ps_3_0 PS_CompositeBlur();
    }
}
technique screen_passthru
{
    pass p0
    {
        VertexShader = compile vs_3_0 vertex_shader_passthru();
        PixelShader = compile ps_3_0 PS_PassThru();
    }
}